<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>
        小程序商城管理平台 </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../css/x-admin.css" media="all">
</head>
<style>
    .black_overlay {
        display: none;
        position: absolute;
        top: 0%;
        left: 0%;
        width: 100%;
        height: 100%;
        background-color: black;
        z-index: 1001;
        -moz-opacity: 0.8;
        opacity: .80;
        filter: alpha(opacity=88);
    }

    .white_content {
        display: none;
        position: absolute;
        top: 25%;
        left: 25%;
        width: 25%;
        height: 55%;
        padding: 20px;
        border: 10px solid lightskyblue;
        background-color: white;
        z-index: 1002;
        overflow: auto;
    }

    #light {
        line-height: 50px;
    }

    #menu {
        line-height: 50px;
    }

    #b {
        text-align: center;
    }

    #from {
        line-height: 20px;
    }

    .div-inline {
        float: left;
    }
</style>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header header header-demo">
        <div class="layui-main">
            <a class="logo" href="index.html">
                一站式商城管理平台
            </a>
            <ul class="layui-nav" lay-filter="">
                <li class="layui-nav-item"><img src="../images/logo.png" class="layui-circle"
                                                style="border: 2px solid #A9B7B7;" width="35px" alt=""></li>
                <li class="layui-nav-item">
                    <a href="javascript:;">admin</a>
                    <dl class="layui-nav-child"> <!-- 二级菜单 -->
                        <dd><a href="">个人中心</a></dd>
                        <dd><a href="../logout">退出</a></dd>
                    </dl>
                </li>
                <!-- <li class="layui-nav-item">
                  <a href="" title="消息">
                      <i class="layui-icon" style="top: 1px;">&#xe63a;</i>
                  </a>
                  </li> -->
                <li class="layui-nav-item x-index"><a th:href="@{'../index'}">首页</a></li>
            </ul>
        </div>
    </div>
    <div class="layui-side layui-bg-black x-side">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree site-demo-nav" lay-filter="side">
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe607;</i><cite>会员管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../user/toUserList'}">
                                <cite>用户列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../user/toAdminList'}">
                                <cite>管理员管理</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../user/toRoleList'}">
                                <cite>角色管理</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../user/toNoteList'}">
                                <cite>短信管理</cite>
                            </a>
                        </dd>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe62d;</i><cite>商品管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toCommodityList'}">
                                <cite>商品列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toClassifyList'}">
                                <cite>商品分类</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toTradeTrademarkList'}">
                                <cite>品牌列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toMoldList'}">
                                <cite>商品类型</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toParameterList'}">
                                <cite>商品属性</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toPropertyList'}">
                                <cite>参数列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toEvaluateList'}">
                                <cite>商品评价</cite>
                            </a>
                        </dd>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe634;</i><cite>订单管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../order/orderlist'}">
                                <cite>订单列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../invoice/invoicelist'}">
                                <cite>发货单列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../billoflading/BillListAll'}">
                                <cite>提货单列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../aftersale/aftersalelist'}">
                                <cite>售后单列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../return/returnlist'}">
                                <cite>退货单列表</cite>
                            </a>
                        </dd>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe642;</i><cite>运营管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../Article/Articlelist'}">
                                <cite>文章列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../notice/noticelist'}">
                                <cite>公告列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../ArticleType/ArticleTypelist'}">
                                <cite>文章分类</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../Advertising/Advertisinglist'}">
                                <cite>广告列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../Advertisingspace/Advertisingspacelist'}">
                                <cite>广告位列表</cite>
                            </a>
                        </dd>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe630;</i><cite>促销管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                            <a th:href="@{'../promotion/seckillList'}">
                                <cite>团购秒杀列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../coupon/couponList'}">
                                <cite>优惠券列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../sales/salesList'}">
                                <cite>促销列表</cite>
                            </a>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe606;</i><cite>财务管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                            <a th:href="@{'../paylist'}">
                                <cite>支付单列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../withdlist'}">
                                <cite>提现列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../metlist'}">
                                <cite>支付方式列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../retlist'}">
                                <cite>退款单列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../acclist'}">
                                <cite>账户资金管理</cite>
                            </a>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe612;</i><cite>控制面板</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                            <a th:href="@{'../explist'}">
                                <cite>导入导出</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../piclist'}">
                                <cite>图片列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../stolist'}">
                                <cite>门店列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../log/loglist'}">
                                <cite>操作日志</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../logisticsCompany/getLogistics'}">
                                <cite>物流公司列表</cite>
                            </a>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe613;</i><cite>微信管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                            <a th:href="@{'../official/getOfficial'}">
                                <cite>公众号配置</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../official/getApplet'}">
                                <cite>小程序配置</cite>
                            </a>
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>

    </div>
    <div class="layui-tab layui-tab-card site-demo-title x-main" lay-filter="x-tab" lay-allowclose="true">
        <div class="x-slide_left"></div>
        <!-- <ul class="layui-tab-title">
             <li class="layui-this">
                 我的桌面
                 <i class="layui-icon layui-unselect layui-tab-close"></i>
             </li>
         </ul>-->

        <div style="padding: 15px;">
            <div class="x-nav">
            <span class="layui-breadcrumb" style="visibility: visible;">
                <a href="">商品管理</a><span lay-separator="">/</span>
                <a href="">商品列表</a>
            </span>
                <a class="layui-btn layui-btn-primary" style="line-height:1.6em;margin-top:3px;float:right"
                   onclick="location.reload()" title="刷新">
                    <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
                </a>
            </div>
            <form class="layui-form seller-form" action="toCommodityList" id="formz1" method="post">
                <div class="layui-form-item">
                    <div class="layui-card-body ">
                        <div class="layui-input-inline layui-show-xs-block">
                            <input type="text" name="name" id="name" placeholder="请输入商品名称" autocomplete="off"
                                   class="layui-input" th:value="${name}">
                        </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <input type="hidden" name="status" id="status" placeholder="请输入商品名称" autocomplete="off"
                                   class="layui-input" th:value="${status}">
                        </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <input type="hidden" name="repertory" id="repertory" placeholder="请输入商品名称"
                                   autocomplete="off" class="layui-input" th:value="${repertory}">
                        </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <button class="layui-btn" type="submit">
                                <i class="layui-icon">&#xe615;</i></button>
                            <a class="layui-btn layui-btn-sm" style="background: orangered" type="button"
                               th:href="@{'toCommodityAdd'}">新增商品</a>
                        </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </div>
                </div>
            </form>
        </div>
        <div style="position: relative;left: 30px; ">
            <form method="post" action="importEmp" id="excelForm" enctype="multipart/form-data">
                <input id="fileName" size="100" name="files" type="file"/>
                <a class="layui-btn layui-btn-sm" style="background: lightskyblue" type="button" id="fileButtom">导入</a>
            </form>
        </div>
        <div>
            <a class="layui-btn layui-btn-sm" style="background: lightskyblue;position: relative;left: 80px;top: -30px"
               type="button"
               th:href="@{'exportEmp'}">导出</a></div>
        <div style="padding: 15px;">
            <div style="padding: 15px;">
                <div class="table-body">
                    <div style="text-align: center;position: relative;left: -15px">
                        <div class="div-inline">
                            <form action="toCommodityList" method="post" id="formAll">
                                <input type="hidden" name="status" value="0">
                                <input type="hidden" name="repertory" value="0">
                                <li class="layui-btn layui-btn-sm" lay-id="all" style="background:blanchedalmond"
                                    id="getAll">全部商品<span class="layui-badge layui-bg-gray" th:text="${numAll}"></span>
                                </li>
                            </form>
                        </div>
                        <div class="div-inline">
                            <form action="toCommodityList" method="post" id="formUp">
                                <input type="hidden" name="status" value="1">
                                <input type="hidden" name="repertory" value="0">
                                <li class="layui-btn layui-btn-sm" lay-id="all" style="background:blanchedalmond "
                                    id="getUp">上架商品<span class="layui-badge layui-bg-gray" th:text="${numUp}"></span>
                                </li>
                            </form>
                        </div>
                        <div class="div-inline">
                            <form action="toCommodityList" method="post" id="formDown">
                                <input type="hidden" name="status" value="2">
                                <input type="hidden" name="repertory" value="0">
                                <li class="layui-btn layui-btn-sm" lay-id="all" style="background:blanchedalmond "
                                    id="getDown">下架商品<span class="layui-badge layui-bg-gray"
                                                           th:text="${numDown}"></span></li>
                            </form>
                        </div>
                        <div class="div-inline">
                            <form action="toCommodityList" method="post" id="formRepertory">
                                <input type="hidden" name="status" value="0">
                                <input type="hidden" name="repertory" value="1">
                                <li class="layui-btn layui-btn-sm" lay-id="all" style="background:blanchedalmond "
                                    id="getRepertory">库存告急<span class="layui-badge layui-bg-gray"
                                                                th:text="${numRepertory}"></span></li>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <table class="layui-table layui-form">
                <thead>
                <tr>
                    <th></th>
                    <th>图片</th>
                    <th>名称</th>
                    <th>销售价</th>
                    <th>成本价</th>
                    <th>市场价</th>
                    <th>分类</th>
                    <th>类型</th>
                    <th>品牌</th>
                    <th>上下架</th>
                    <th>库存</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="list:${session.commodityList}">
                    <td th:text="${list.id}"></td>
                    <td><img th:src="@{'../../images/'+${list.imgPath}}" height="30" width="20"/></td>
                    <td th:text="${list.name}"></td>
                    <td th:text="${list.salesPrice}"></td>
                    <td th:text="${list.costPrice}"></td>
                    <td th:text="${list.marketPrice}"></td>
                    <td th:text="${list.classifyName}"></td>
                    <td th:text="${list.moldName}"></td>
                    <td th:text="${list.trademarkName}"></td>
                    <td><span th:if="${list.status==1}">
                            <a title="下架" th:id="${list.id}" href="javascript:void(0);" onclick="dowm(this)">
                                <i class="layui-icon">&#xe61a;</i></a>
                        </span>
                        <span th:if="${list.status==2}">
                            <a title="上架" th:id="${list.id}" href="javascript:void(0);" onclick="up(this)">
                                <i class="layui-icon">&#xe619;</i></a>
                        </span>
                    </td>
                    <td th:text="${list.repertory}"></td>
                    <td class="td-manage">
                        <a title="查看评价" th:href="@{'toCommodityEvaluate?commodityId='+${list.id}}">
                            <i class="layui-icon">&#xe63a;</i></a>
                        <a title="编辑" th:href="@{'toCommodityUpdate?id='+${list.id}}">
                            <i class="layui-icon">&#xe642;</i></a>
                        <a title="删除" th:id="${list.id}" href="javascript:void(0);" onclick="del1(this)">
                            <i class="layui-icon">&#xe640;</i></a>
                    </td>
                </tr>
                </tbody>
            </table>
            <div id="b">
                <tr>
                    <span th:if="${name!=null}">
                <span th:if="${session.page.pageNo>1}">
                    <a class="layui-btn layui-btn-sm" th:href="@{'toCommodityList?no='+1+'&name='+${name}}">首页</a>
                    <a class="layui-btn layui-btn-sm"
                       th:href="@{'toCommodityList?no='+${session.page.pageNo-1}+'&name='+${name}}">上一页</a>
                 </span>
                    <span th:if="${session.page.pageNo<session.page.pageSum}+'&name='+${name}">
                    <a class="layui-btn layui-btn-sm"
                       th:href="@{'toCommodityList?no='+${session.page.pageNo+1}+'&name='+${name}}">下一页</a>
                    <a class="layui-btn layui-btn-sm"
                       th:href="@{'toCommodityList?no='+${session.page.pageSum}+'&name='+${name}}">末页</a>
                    </span>
                    </span>
                    <span th:if="${name==null}">
                <span th:if="${session.page.pageNo>1}">
                    <a class="layui-btn layui-btn-sm" th:href="@{'toCommodityList?no='+1}">首页</a>
                    <a class="layui-btn layui-btn-sm"
                       th:href="@{'toCommodityList?no='+${session.page.pageNo-1}}">上一页</a>
                 </span>
                    <span th:if="${session.page.pageNo<session.page.pageSum}">
                    <a class="layui-btn layui-btn-sm"
                       th:href="@{'toCommodityList?no='+${session.page.pageNo+1}}">下一页</a>
                    <a class="layui-btn layui-btn-sm" th:href="@{'toCommodityList?no='+${session.page.pageSum}}">末页</a>
                    </span>
                    </span>
                    第<span th:text="${session.page.pageNo}"></span>页/
                    共<span th:text="${session.page.pageSum}"></span>页
                    <span th:text="${session.page.count}"></span>条记录
                </tr>
            </div>
        </div>
    </div>
</div>
<div class="site-mobile-shade">
</div>
</div>
<script src="../lib/layui/layui.js" charset="utf-8"></script>
<script src="../js/x-admin.js"></script>
<script src="../js/sweetalert-dev.js"></script>
<link rel="stylesheet" href="../../css/sweetalert.css" media="all">
<script th:src="@{/webjars/jquery/3.3.1/jquery.min.js}"></script>
<script type="text/javascript">
    function del1(obj) {

     var id = $(obj).attr("id");
    swal({
  title: "确定删除吗？",
  text: "你将无法恢复该商品！",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "确定删除！",
  cancelButtonText: "取消删除！",
  closeOnConfirm: false,
  closeOnCancel: false
},
function(isConfirm){
  if (isConfirm) {
   location.href = 'toCommodityDelete?id=' + id;
    swal("删除！", "你的商品已经被删除。",
"success");
  } else {
    swal("取消！", "你的商品是安全的:)",
"error");
  }
});

        <!--var id = $(obj).attr("id");-->
        <!--if (confirm("确实要删除吗？")) {-->
            <!--location.href = 'toCommodityDelete?id=' + id;-->
            <!--alert("已删除");-->
        <!--} else {-->
            <!--alert("已经取消了删除操作");-->
        <!--}-->
    }
    function up(obj) {
        var id = $(obj).attr("id");
      swal({
        title: "确定上架吗？",
        text: "你将无法恢复该操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
  confirmButtonText: "确定上架！",
  cancelButtonText: "取消上架！",
  closeOnConfirm: false,
  closeOnCancel: false
},
function(isConfirm){
  if (isConfirm) {
  location.href = 'toCommodityUp?id=' + id;
    swal("上架！", "你的商品已经被上架。",
"success");
  } else {
    swal("取消！", "你的商品已取消上架:)",
"error");
  }
});




        <!--if (confirm("确实将此商品上架吗？")) {-->
            <!--location.href = 'toCommodityUp?id=' + id;-->
            <!--alert("已上架");-->
        <!--} else {-->
            <!--alert("已经取消了上架操作");-->
        <!--}-->
    }
    function dowm(obj) {



       var id = $(obj).attr("id");
      swal({
        title: "确定下架吗？",
        text: "你将无法恢复该操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
  confirmButtonText: "确定下架！",
  cancelButtonText: "取消下架！",
  closeOnConfirm: false,
  closeOnCancel: false
},
function(isConfirm){
  if (isConfirm) {
  location.href = 'toCommodityDown?id=' + id;
    swal("下架！", "你的商品已经被下架。",
"success");
  } else {
    swal("取消！", "你的商品已取消下架:)",
"error");
  }
});

        <!--var id = $(obj).attr("id");-->
        <!--if (confirm("确实要此商品下架吗？")) {-->
            <!--location.href = 'toCommodityDown?id=' + id;-->
            <!--alert("已下架");-->
        <!--} else {-->
            <!--alert("已经取消了下架操作");-->
        <!--}-->
    }

    $(function () {
        $("#fileName").hide();
        $("#getAll").click(function () {
            $("#formAll").submit();
        });

        $("#getUp").click(function () {
            $("#formUp").submit();
        });

        $("#getDown").click(function () {
            $("#formDown").submit();
        });

        $("#getRepertory").click(function () {
            $("#formRepertory").submit();
        });
        $("#fileName").change(function () {
            $("#excelForm").submit();
        });
        $("#fileButtom").click(function () {
            $("#fileName").click();
        })
    })







</script>
</body>
</html>
